package com.umerclass.ui.anmo.customer.adapter;

import android.content.Context;
import android.graphics.Paint;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.bumptech.glide.RequestManager;
import com.umerclass.R;
import com.umerclass.bean.customer.TaoCanBean;
import com.umerclass.frame.ui.recycleview.adapter.RecyclerviewBasicAdapter;
import com.umerclass.frame.ui.recycleview.base.ViewHolder;
import com.umerclass.frame.ui.recycleview.listener.OptListener;

import java.util.List;

/**
 * Created by jack
 */

public class CustomerHomeAdapter extends RecyclerviewBasicAdapter<TaoCanBean> {

    private OptListener optListener;
    private RequestManager glideRequestManager;
    private LinearLayout linear;

    public CustomerHomeAdapter(Context context, List datas, int layoutId, RequestManager glideRequestManager,
                               OptListener optListener) {
        super(context, datas, layoutId);
        this.optListener = optListener;
        this.glideRequestManager = glideRequestManager;
    }

    public CustomerHomeAdapter(Context context, List datas, int layoutId, OptListener optListener) {
        super(context, datas, layoutId);
        this.optListener = optListener;
    }

    @Override
    public void convert(ViewHolder holder, final TaoCanBean bean, final int position) {
        LinearLayout linear = holder.getView(R.id.linear);
        TextView tv_one = holder.getView(R.id.tv_one);
        TextView tv_two = holder.getView(R.id.tv_two);
        TextView tv_three = holder.getView(R.id.tv_three);
        TextView tv_four = holder.getView(R.id.tv_four);
        TextView tv_mai =  holder.getView(R.id.tv_mai);
        tv_one.setText(bean.getName());
        tv_two.setText("¥"+ bean.getPrice());
        tv_three.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG );
        tv_three.setText("¥"+ bean.getPrice());
        tv_four.setText(bean.getTotalNum()+"次");
        tv_mai.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                optListener.onOptClick(v,position);
            }
        });
    }

}
